<include file="Public/header"/>

		<div id="app">
			<!-- sidebar -->
			<include file="Public/left"/>
			<!-- / sidebar -->
			<div class="app-content">
				<!-- start: TOP NAVBAR -->
				<include file="Public/headernav"/>
				<!-- end: TOP NAVBAR -->
				<div class="main-content" >
					<div class="wrap-content container" id="container">
						<!-- start: PAGE TITLE -->
						<section id="page-title">
							<div class="row">
								<div class="col-sm-8 col-md-offset-5">
									<h1 class="mainTitle">{$msgtitle}</h1>
									<span class="mainDescription">&nbsp;数据字典信息</span>
								</div>
								
							</div>
						</section>
						<!-- end: PAGE TITLE -->
						<!-- start: YOUR CONTENT HERE -->
<div class="container-fluid container-fullw bg-white">
<form action="" role="form" id="form2" novalidate="novalidate" method="post">
<div class="row">
	<div class="col-md-6 col-md-offset-3">
	<div class="form-group" style="display:none;">
		<label class="control-label">
			字典参数code <span class="symbol required" aria-required="true"></span>
		</label>
		<if condition="$_SESSION.topadmin eq 1">
			<if condition="$data.id gt 0">
				{//超级管理员}
			<input type="text" placeholder="填写字典参数" class="form-control" value="{$data.param_code}" id="param_code" name="param_code" 
			 disabled >
			<else/>
			<input type="text" placeholder="填写字典参数" class="form-control" value="{$data.param_code}" id="param_code" name="param_code">
		    </if>
	    <else/>
	       <input type="text" placeholder="填写字典参数" class="form-control" value="{$data.param_code}" id="param_code" name="param_code">
	    </if>
	</div>

    <div class="form-group">
		<label>
			 参数名称
		</label>
		<input type="text" class="form-control" value="{$data.param_name}"  name="param_name" id="param_name" <if condition="$data.id gt 0">disabled</if>>
	</div>


    <div class="form-group">
		<label class="control-label">
			值类型 <span class="symbol required" aria-required="true"></span>(类型确定后不能修改)
		</label>
		
			<if condition="$data.id gt 0">
			   <if condition="$data.type eq 1">短文本<else/>长文本</if>
			   <input type="hidden" id="type"  value="{$data.type}" name="type">
			<else/>
			   <select class="form-control" id="type" name="type">
			   	<option value="1">短文本</option>
	            <option value="2">长文本</option>
	           </select>
	       </if>
	</div>
   
     
	<div class="form-group">
		<div class="type_1" <if condition="$data.type eq 2">style="display:none"</if>>
		<label class="control-label">
			参数值 <span class="symbol required" aria-required="true"></span>
		</label>
		<input type="text" placeholder="填写参数值" class="form-control" value="{$data.param_value}" id="type_1" name="type_1">
	   </div>
	   <div class="type_2" <if condition="$data.type neq 2">style="display:none"</if>>
			<label class="control-label">
				参数值： <span class="symbol required" aria-required="true"></span>
			</label>
			<div>
			<textarea id="type_2" name="type_2"  class=" autosize" data-autosize-on="true" style="overflow: hidden; resize: horizontal; word-wrap: break-word;  width: 100%;  height: 300px;">{$data.param_value}</textarea>
			 <!-- 加载编辑器的容器 -->
		    </div>
	     </div>
	     <input type="hidden" placeholder="" class="form-control" value="" id="msg" name="msg">
	</div>

	<div class="form-group " >
		
	 
	</div>
	
    
    <div class="form-group">
		<label class="control-label">
			参数描述 
		</label>
		<textarea class="form-control autosize" name="param_desc" data-autosize-on="true" style="overflow: hidden; resize: horizontal; word-wrap: break-word; height: 71px;">{$data.param_desc}</textarea>
	</div>

</div>
</div>
<div class="row">
<div class="col-md-4 col-md-offset-5">
	<input type="hidden"  value="{$data.id}" name="id">
	<input type="hidden"  value="0" name="is_key">
	<button class="btn btn-primary btn-wide pull-left" type="submit">
		提交 <i class="fa fa-arrow-circle-right"></i>
	</button>
</div>

<div class="col-md-8">
	<p>
		
	</p>
</div>

</div>											
</form>
</div>	


                  





						<!-- end: YOUR CONTENT HERE -->
					</div>
				</div>
			</div>
			<!--  FOOTER and SETTINGS -->
			
           <include file="Public/footer"/>
			<!-- end: FOOTER -->
			<!-- start: OFF-SIDEBAR -->
			
			<!-- end: OFF-SIDEBAR -->
			
		</div>
		<!-- start: MAIN JAVASCRIPTS -->

         <include file="Public/javascript"/>
		
		<!-- end: CLIP-TWO JAVASCRIPTS -->

		<!-- start: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
		<script src="__PUBLIC__/bootstrap/vendor/ckeditor/ckeditor.js"></script>
		<script src="__PUBLIC__/bootstrap/vendor/ckeditor/adapters/jquery.js"></script>
		<script src="__PUBLIC__/bootstrap/vendor/jquery-validation/jquery.validate.min.js"></script>

 <!-- 配置文件 -->
    <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('type_2');
    </script>

  <script type="text/javascript">
       jQuery(document).ready(function() {
				//FormValidator.init();
	jQuery.validator.addMethod("get_param_value", function(value) {
		var dropdown=$("#type").val();
		var ret =true;
		//2 长文本
	    if(dropdown==2){
	        ret=ue.hasContents();
	    }else{
	    	var type_1=$("#type_1").val();
	    	if(!type_1){
	    		ret=false;
	    	}
	    }
	  return ret;   
	});

});
    </script>   
		<!-- end: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
		<!-- start: CLIP-TWO JAVASCRIPTS -->
		<!-- <script src="__PUBLIC__/bootstrap/assets/js/main.js"></script> -->
		<!-- start: JavaScript Event Handlers for this page -->
		<!--<script src="__PUBLIC__/bootstrap/assets/js/form-validation.js"></script>-->
<if condition="$data.id gt 0">
{//编辑}
	<script>
jQuery(document).ready(function() {
				//FormValidator.init();

	$("#form2").validate({
	  rules: {
	   param_name: "required",
	    msg: "get_param_value"
	  },
	  messages: {
	  param_name: "请输入参数名称",	
	  msg: "请输入参数值"
	  }
	  });
	});
		</script>		
<else/>
{//新增}
	<script>
jQuery(document).ready(function() {
				//FormValidator.init();

	$("#form2").validate({
	  rules: {
	   param_code:{
	   	required:true,
	   	remote: {
                        url: "{:U('admin/System/sys_param_edit')}",
                        type: "get",
                        dataType: "json",
                        data: {
                            param_code: function () {
                                return $("#param_code").val();　　　　//这个是取要验证的密码
                            }
                        },
                        dataFilter: function (msg) {　　　　//判断控制器返回的内容
                            if (msg == "0") {
                                return true;
                            }else {
                                return false;
                            }
                        }
                    }
	   },
	   param_name: "required",
	   msg: "get_param_value"
	  },
	  messages: {
	   param_code: {
	   	required:"请输入字典参数code",
	   	remote:"该字典参数code已存在"
	   },
	   param_name: "请输入参数名称",
	    msg: "请输入参数值"
	  }
	  });
	});
		</script>
</if>	
<script type="text/javascript">
	$(function(){


$("#type").change(function(){
	var val=$(this).val();
	if(val==1){
		$(".type_2").hide();
		$(".type_1").show();
	}else{
		$(".type_1").hide();
		$(".type_2").show();
	}

});
	});

</script>


   
		<!-- end: JavaScript Event Handlers for this page -->
	</body>
</html>
